import {default as Layout, Welcome } from '@/layout'
const DirectNest = () => import("@/components/DirectNest/index.vue")
import type { RouteRecordRaw } from 'vue-router';


export const constantRoutes: RouteRecordRaw[] = [
  {
    path: "/login",
    name: "登录页",
    meta: { hidden: true },
    component: () => import('../views/login.vue'),
    
  },
  {
    path: "/welcome",
    name: "welcome",
    meta: { hidden: true },
    component: Welcome,
  }
];


export const dynamicRoutes: RouteRecordRaw[] = [
  {
    path: "/",
    component: Layout,
    redirect: "/dashboard",
    children: [
      {
        path: "dashboard",
        component: () => import('@/views/dashboard/index.vue'),
        name: "DashboardView",
        meta: { title: "首页", icon: "el-icon-odometer", affix: true },
      },
    ],
  },
  {
    path: "/system",
    component: Layout,
    meta: { title: "系统管理", icon: "system" },
    children: [
      {
        path: "user",
        component: () => import("@/views/system/user/index.vue"),
        name: "UserView",
        meta: { title: "用户管理", icon: "el-icon-user-filled", permission: 'system:user:view' },
      },
      {
        path: "dept",
        component: () => import("@/views/system/dept/index.vue"),
        name: "DeptView",
        meta: { title: "部门管理", icon: "tree", permission: 'system:department:view' },
      },
      {
        path: "role",
        component: () => import("@/views/system/role/index.vue"),
        name: "RoleView",
        meta: { title: "角色管理", icon: "peoples", permission: 'system:role:view' },
      },
      {
        path: "api",
        component: () => import("@/views/system/api/index.vue"),
        name: "ApiView",
        meta: { title: "页面接口", icon: "el-icon-connection", permission: 'system:page-api:view' },
      },
      {
        path: "menu",
        component: () => import("@/views/system/menu/index.vue"),
        name: "MenuView",
        meta: { title: "菜单管理", icon: "tree-table", permission: 'system:menu:view' },
      },
      {
        path: "dict",
        component: () => import("@/views/system/dict/index.vue"),
        name: "DictView",
        meta: { title: "字典管理", icon: "dict", permission: 'system:dict:view' },
      },
      {
        path: "config",
        component: () => import("@/views/system/config/index.vue"),
        name: "ConfigView",
        meta: { title: "配置管理", icon: "el-icon-operation", permission: 'system:config:view' },
      },
      {
        path: "log",
        component: DirectNest,
        meta: { title: "日志管理",icon: "el-icon-folder-opened" },
        children: [
          {
            path: "operation",
            name: "OpLog",
            meta: { title: "操作日志", icon: "log", permission: 'system:sys-log:view' },
            component: () => import("@/views/system/log/op-log.vue"),
          },
          {
            path: "login",
            name: "LoginLog",
            meta: { title: "登录日志", icon: "log", permission: 'system:sys-log:view' },
            component: () => import("@/views/system/log/login-log.vue"),
          },
        ],
      },
    ],
  }
]



export const constantTailRoutes: RouteRecordRaw[] = [
  {
    path: '/404',
    name: 'staticRoutes.notFound',
    component: () => import('@/views/error/404.vue'),
    meta: {
      hidden: true
    },
  },
];